﻿using System;
using System.ComponentModel;
using System.Linq;
using Inaction.Core;
using Inaction.Mapping;
using System.ComponentModel.DataAnnotations;

namespace Inaction.Business.Security
{
    [Table("AssemblyClassRole"), DisplayName("程序集类角色"), Serializable]
    public class AssemblyClassRole : Abstract.AssemblyClassRole<AssemblyClassRole>
    {
        #region 子表

        #endregion

        protected override void OnPropertyChanged(IProperty property)
        {
            base.OnPropertyChanged(property);
            if (property == AllowEditProperty || property == AllowRemoveProperty)
            {
                if (property.GetFieldValue(this).Equals(true))
                {
                    AllowQuery = true;
                }
            }
            else if (property == AllowNewProperty)
            {
                if (property.GetFieldValue(this).Equals(true))
                {
                    AllowEdit = true;
                }
            }
            else if (property == AllowQueryProperty)
            {
                if (property.GetFieldValue(this).Equals(false))
                {
                    AllowEdit = AllowNew = AllowRemove = false;
                }
            }

        }
    }

    [DisplayName("程序集类角色列表"), Serializable]
    public class AssemblyClassRoleList : Inaction.Business.EntityList<AssemblyClassRoleList, AssemblyClassRole>
    {
    }
}
